<?php
class Answer_Component_Block_Userinfo extends Phpfox_Component {
    public function process() {
        if(Phpfox::getUserId() != 0) {
            $aUser = Phpfox::getService('answer.level')->getUserInfo(Phpfox::getUserId());
            if ($aUser['maxpoint'] == 0) {
                $sPhrase ="";
            }
            else {
                $iPointUpLevel = $aUser['maxpoint'] - $aUser['point'] + 1;
                $sPhrase = Phpfox::getPhrase('answer.need_point_to_level_up',array(
                    'point' => $iPointUpLevel));
            }

            $aCount = Phpfox::getService('answer.point')->getUserInfo(Phpfox::getUserId());
            $this->template()

                ->assign(array(
                'sHeader' => Phpfox::getPhrase('answer.your_info'),
                'aUser' => $aUser,
                'phrase' => $sPhrase,
                'aCount' => $aCount
            ));
            return 'block';
        }
        else
        {
            $this->template()->assign('aUser', array());
        }
    }
}